package match_data

import (
	"github.com/spf13/cast"
	"longmen/server/internal/services/nami/services/sports/basketball/bbcache"
	"longmen/server/internal/services/nami/services/sports/football/fbcache"
)

func GetLineupData(roomId string) (historyMsg []string) {
	//嘗試獲取陣容
	if lineupMsg, has := lineupHistory(roomId); has {
		historyMsg = append(historyMsg, lineupMsg)
	}
	return historyMsg
}
func lineupHistory(roomId string) (string, bool) {
	matchId := cast.ToInt(roomId)
	var cache string

	cache = bbcache.NewLineUpCache().GetLineUpCache(matchId)
	if len(cache) > 0 {
		return cache, true
	}
	cache = fbcache.NewLineUpRedis().GetLineUpCache(matchId)
	if len(cache) > 0 {
		return cache, true
	}
	return "", false
}
